package com.baosight.sczx.common.zm.cInterface.cs;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.iplat4j.ep.QueryMap;
import com.baosight.sczx.zm.cb.domain.ZMCBRoadway;
import com.baosight.sczx.zm.cb.domain.ZMCBWorkingface;
import com.baosight.sczx.zm.cs.domain.ZMCSEngineering;


/**
 * <p>Title: Engineering.java</p>
 * <p>Description: 工程信息的对外接口</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2011-3-4 下午05:09:33  张志芳  Create
 *</pre>
 */
public class Engineering {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 构造工程模型树 根据 工作面、巷道、其他设计的 ID
	 * <p>Function: getEngineeringModelTreeById</p>
	 * <p>Description: </p>
	 * <p>return value:List</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-13下午12:10:34 严洪浩
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	public static List getEngineeringModelTreeById(String parentId) {
		List  _list = new ArrayList();
		try {
			Map<String, String> params = new HashMap<String, String>();
			params.put("fdParentId", parentId);
			_list = dao.query("ZMCSEngineering.queryTree", params);;
		} catch (Exception e) {
			System.out.println("构造工程模型树失败: " + e.getMessage());
		}
		return _list;
	}
	
	/**
	 * 获取满足查询条件的所有工程信息
	 * 供ZMCP 调度台帐模块使用
	 * <p>Function: getEngineeringInfo</p>
	 * <p>Description: </p>
	 * <p>return value:EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-3-4下午05:23:30 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static EiInfo getEngineeringInfo(EiInfo inInfo){                    	
		try {
			List<Map>  _list = new ArrayList();
			QueryMap queryInfo = QueryMap.getQueryMap(inInfo);
			_list = dao.query("ZMCSEngineering.queryInterface", queryInfo);
			inInfo.getBlock(EiConstant.resultBlock).addRows(_list);

		} catch (Exception e) {
			System.out.println("获取满足查询条件的所有工程信息失败: " + e.getMessage());
		}
		return inInfo;
	}
	
	/**
	 * 获取满足条件的工程
	 * 设备卡片模块使用
	 * <p>Function: getDepartments</p>
	 * <p>Description: </p>
	 * <p>return value:List<Map></p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-4-8上午11:03:41 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static List<Map> getEngineerings(QueryMap map){                                                              
		List<Map> _list = new ArrayList<Map>();
		try {
			_list = dao.query("ZMCSEngineering.queryInterface", map);
		} catch (Exception e) {
			System.out.println("获取满足条件的工程失败: " + e.getMessage());
		}
		return _list;
	}
	
	/**
	 * 根据工程ID,获取满足条件的工程Map
	 * 供设备变动模块使用
	 * <p>Function: getDepartments</p>
	 * <p>Description: </p>
	 * <p>return value:List<Map></p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-4-8上午11:03:41 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static Map getEngineeringMapById(String id)
	{
		Map map = new HashMap();
		if(id==null || id.equals("")) {
			return map;
		}
		else {
			id = id.trim();
		}
		
		Map<String, String> _map = new HashMap<String, String>();
		_map.put("orgCode", id);
		List<Map> _list = new ArrayList<Map>();
		
		try {
			QueryMap queryInfo = new QueryMap();
			queryInfo.put("fdKeyId", id);
			_list = dao.query("ZMCSEngineering.queryInterface", queryInfo);
		} catch (Exception e) {
			System.out.println("根据工程ID,获取满足条件的工程失败: " + e.getMessage());
		}
		
		if(_list.size() < 1) {
			return map;
		}
		else {
			map = _list.get(0);
		}
		return map;
	}
	
	/**
	 * 供工程查询模块构造树使用
	 * <p>Function: getDepartToProjectInfo</p>
	 * <p>Description: </p>
	 * <p>return value:List<Map></p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-14上午05:26:06 严洪浩
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List<Map> getDepartToProjectInfo(){                                                              
		List<Map> _list = new ArrayList<Map>();
		try {
			_list = dao.query("ZMCSEngineering.queryAllDepartment", null);
		} catch (Exception e) {
			System.out.println("工程查询模块构造树失败: " + e.getMessage());
		}
		return _list;
	}
	
	/**
	 * 构造工程Block
	 * <p>Function: getEngineering</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-28上午11:37:52 严洪浩
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public static EiBlock getEngineering(String _blockID, String _status, boolean isAll) {
		EiBlock block = new EiBlock(_blockID);

		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		eiColumn = new EiColumn("fdName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		List<Map> _list = new ArrayList<Map>();
		if(isAll)  {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdKeyId", "");
			_map.put("fdName", "");
			_list.add(_map);
		}
		
		QueryMap queryInfo = new QueryMap();
		if(_status != null && !_status.equals("")) {
			queryInfo.put("notFdStatus", _status);
		}

		List<Map> _temp = dao.query("ZMCSEngineering.queryInterface", queryInfo);
		for(int i = 0; i < _temp.size(); i++) {
			_list.add(_temp.get(i));
		}
		
		block.setRows(_list);
		return block;
	}
	
	/**
	 * 查询开工工程名
	 * <p>Function: getAllWorkingFace</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-12上午08:45:08 张坤
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getApplyProject(String _blockID, boolean isAll) {
		List<Map>  _list = new ArrayList<Map>();
		_blockID = _blockID == null ? "cmes.cm.applyProject" : _blockID;
		
		QueryMap queryInfo =new QueryMap();
		queryInfo.put("fdStatus","1");

		
		EiBlock block = new EiBlock(_blockID);

		EiColumn eiColumn = new EiColumn("fdNo");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		eiColumn = new EiColumn("fdName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
	
		try {
			List<Map> _temp = dao.query("ZMCSEngineering.queryInterface", queryInfo);
			_temp = _temp== null ? new ArrayList<Map>(): _temp;
			 
			for(int i = 0; i < _temp.size(); i++) {
				Map<String, String> _map = new HashMap<String, String>();
				_map.put("fdNo", _temp.get(i).get("fdNo").toString());
				_map.put("fdName", _temp.get(i).get("fdName").toString());
				_list.add(_map);
			}
		} catch (Exception e) {
			System.out.println("查询开工工程名失败: " + e.getMessage());
		}

		block.setRows(_list);
		return block;
	}
	
	/**
	 * 验证 工作面 巷道 其他 下面是否存在工程
	 * <p>Function: validate</p>
	 * <p>Description: </p>
	 * <p>return value:boolean</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-13上午08:27:19 严洪浩
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static boolean validateHasChildren(Map<String,List<String>> _argMap, EiInfo eiInfo) {
		_argMap = _argMap == null ? new HashMap<String, List<String>>():_argMap;
		
		List<Map>  _list = new ArrayList();
		
		try {
			_list = dao.query("ZMCSEngineering.validateHasChildren", _argMap);
			if(_list.size() < 1) {
				return false;
			}
			else {
				eiInfo.setStatus(-1);
				eiInfo.setMsg("下级已经存在工程，不能删除！");
			}
		} catch (Exception e) {
			System.out.println("验证工作面巷道其他下面是否存在工程异常: " + e.getMessage());
		}
		
		return true;
	}
	/**
	 * 构造工程详细的Block
	 * <p>Function: getEngineering</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-15上午11:37:52 王琪
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public static EiBlock getEngineeringDetail(String _blockID,String typeParams,String classParams,String _status,boolean isAll) {
		EiBlock block = new EiBlock(_blockID);
		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdNo");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		eiColumn = new EiColumn("fdNoName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdAbbreviation");//工程简称
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdType");//工程类型
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPlanBeginDate");//计划开工日期
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPlanEndDate");//计划竣工日期
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPlanAmount");//工程计划量
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdUnit");//计划量单位ID
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdProjectPlace");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdStatus");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdClass");//钻孔类别
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdDepartment");//施工部门
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdDepartmentId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		List<Map> _list = new ArrayList<Map>();
		if(isAll)  {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdKeyId", "");
			_map.put("fdNo", "");
			_map.put("fdName", "");
			_map.put("fdNoName", "");
			_map.put("fdAbbreviation", "");//工程简称
			_map.put("fdType", "");//工程类型
			_map.put("fdPlanBeginDate", "");//计划开工日期
			_map.put("fdPlanEndDate", "");//计划竣工日期
			_map.put("fdPlanAmount", "");//工程计划量
			_map.put("fdUnit", "");//计划量单位ID
			_map.put("fdProjectPlace", "");
			_map.put("fdClass", "");//工程小类
			_list.add(_map);
		}
		
		QueryMap queryInfo = new QueryMap();
		if(_status != null && _status.equals("2")) {
			queryInfo.put("notFdStatus", _status);
		}
		if(_status != null && _status.equals("1")) {
			queryInfo.put("fdStatus", _status);
		}
		if(null != typeParams && !"".equals(typeParams))
		{
			queryInfo.put("fdType", typeParams);
		}
		if(null != classParams  && !"".equals(classParams)) {
			queryInfo.put("fdClass", classParams);
		}

		List<Map> _temp = dao.query("ZMCSEngineering.queryInterface", queryInfo);
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}
	
	/**
	 * 构造工程详细的Block
	 * <p>Function: getEngineering</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-15上午11:37:52 王琪
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public static EiBlock getEngineeringDetail(String _blockID,String typeParams,String _status,boolean isAll) {
		EiBlock block = new EiBlock(_blockID);
		
		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdNo");
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		eiColumn = new EiColumn("fdNoName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdBeginDate");//计划开工日期
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdProjectPlace");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdParentId");//巷道id
		eiColumn.setType("C");
		block.addMeta(eiColumn);

		List<Map> _list = new ArrayList<Map>();
		if(isAll)  {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdKeyId", "");
			_map.put("fdNo", "");
			_map.put("fdName", "");
			_map.put("fdNoName", "");
			_map.put("fdBeginDate", "");//计划开工日期
			_map.put("fdProjectPlace", "");
			_map.put("fdParentId", "");//工程小类
			_list.add(_map);
		}
		
		QueryMap queryInfo = new QueryMap();
		if(_status != null && !_status.equals("")) {
			queryInfo.put("fdStatus", _status);
		}
		if(null != typeParams && !"".equals(typeParams))
		{
			queryInfo.put("fdType", typeParams);
		}

		List<Map> _temp = dao.query("ZMCSEngineering.queryInterface", queryInfo);
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}
	
	/**
	 * 
	 * <p>Function: updateStatus</p>
	 * <p>Description: 修改工程状态</p>
	 * <p>return value:void</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-19下午03:28:46 张小飞
	 * </p>
	 *
	 */
	public static void updateStatus(Map<String, String> _map){
		try {
			dao.update("ZMCSEngineering.updateStatus", _map);
		} catch (Exception e) {
			System.out.println("更新工程状态失败！"+e.getMessage());
		}
	} 
	
	/**
	 * <p>Function: updateEngineeringDepartment</p>
	 * <p>Description: 修改工程的施工部门</p>
	 * <p>return value:void</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-25下午01:47:57 张小飞
	 * </p>
	 *
	 */
	public static void updateEngineeringDepartment(Map<String, String> _map){
		try {
			dao.update("ZMCSEngineering.updateDepartment", _map);
		} catch (Exception e) {
			System.out.println("更新工程施工部门失败！"+e.getMessage());
		}
	} 
	/**
	 * <p>Function: getEngineeringForCM</p>
	 * <p>Description: 供生产过程管理采煤计划下拉框使用,可以使用矿井和部门过滤</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-8-29 15:22:43 王伟
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getEngineeringForCM(String blockName, String type, String _class, String status, boolean isAll, String miningId, String departmentId){
		EiBlock block = new EiBlock(blockName);
		
		block.addBlockMeta(new ZMCSEngineering().eiMetadata);
		block.addBlockMeta(new ZMCBWorkingface().eiMetadata);
		block.addMeta(new EiColumn("fdNoName"));

		List<Map> _list = new ArrayList<Map>();
		if(isAll) {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdNoName", "");
			_list.add(_map);
		}
		
		Map params = new HashMap();
		params.put("fdType", type);
		params.put("fdStatus", status);
		params.put("fdClass", _class);
		params.put("fdMiningId", miningId);
		if(departmentId != null && !"".equals(departmentId))
			params.put("fdDepartmentId", departmentId);
		List<Map> _temp = dao.query("ZMCSEngineering.queryForZMCPPlanCM", params);
		
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}

	/**
	 * <p>Function: getEngineeringForCM</p>
	 * <p>Description: 供生产过程管理掘进计划下拉框使用</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-8-30 13:32:55  王伟
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getEngineeringForJJ(String blockName, String type, String _class, String status, boolean isAll, String miningId, String departmentId){
		EiBlock block = new EiBlock(blockName);
		
		block.addBlockMeta(new ZMCSEngineering().eiMetadata);
		block.addBlockMeta(new ZMCBRoadway().eiMetadata);
		block.addMeta(new EiColumn("fdNoName"));

		List<Map> _list = new ArrayList<Map>();
		if(isAll) {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdNoName", "");
			_list.add(_map);
		}
		
		Map params = new HashMap();
		params.put("fdStatus", status);
		params.put("fdType", type);
		params.put("fdClass", _class);
		params.put("fdMiningId", miningId);
		if(departmentId != null && !"".equals(departmentId))
			params.put("fdDepartmentId", departmentId);
		
		List<Map> _temp = dao.query("ZMCSEngineering.queryForZMCPPlanJJ", params);
		
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}
	
	/**
	 * <p>Function: getEngineeringForCM</p>
	 * <p>Description: 供生产过程管理采煤计划下拉框使用</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-22下午05:24:22 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getEngineeringForCM(String blockName, String type, String _class, String status, boolean isAll, String miningId){
		EiBlock block = new EiBlock(blockName);
		
		block.addBlockMeta(new ZMCSEngineering().eiMetadata);
		block.addBlockMeta(new ZMCBWorkingface().eiMetadata);
		block.addMeta(new EiColumn("fdNoName"));

		List<Map> _list = new ArrayList<Map>();
		if(isAll) {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdNoName", "");
			_list.add(_map);
		}
		
		Map params = new HashMap();
		params.put("fdType", type);			//工程类型
		params.put("fdStatus", status);		//工程状态
		params.put("fdClass", _class);		//工程小类
		params.put("fdMiningId", miningId);
		List<Map> _temp = dao.query("ZMCSEngineering.queryForZMCPPlanCM", params);
		
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}
	
	/**
	 * <p>Function: getEngineeringForCM</p>
	 * <p>Description: 供生产过程管理掘进计划下拉框使用</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-22下午05:24:22 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getEngineeringForJJ(String blockName, String type, String _class, String status, boolean isAll, String miningId){
		EiBlock block = new EiBlock(blockName);
		
		block.addBlockMeta(new ZMCSEngineering().eiMetadata);
		block.addBlockMeta(new ZMCBRoadway().eiMetadata);
		block.addMeta(new EiColumn("fdNoName"));

		List<Map> _list = new ArrayList<Map>();
		if(isAll) {
			Map<String, String> _map = new HashMap<String, String>();
			_map.put("fdNoName", "");
			_list.add(_map);
		}
		
		Map params = new HashMap();
		params.put("fdType", type);
		params.put("fdStatus", status);
		params.put("fdClass", _class);
		params.put("fdMiningId", miningId);
		List<Map> _temp = dao.query("ZMCSEngineering.queryForZMCPPlanJJ", params);
		
		for(int i = 0; i < _temp.size(); i++) {
			Map _map = _temp.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
			_list.add(_map);
		}
		
		block.setRows(_list);
		return block;
	}
	
	
	/**
	 * 获取做过计划的工程下拉框
	 * <p>Function: getPlanEngineering</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-22下午12:35:08 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static EiBlock getPlanEngineering(String blockName, String fdType, String fdNotStatus) {

		EiBlock block = new EiBlock(blockName);
 
		EiColumn eiColumn = new EiColumn("empCode");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdKeyId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdNo");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdName");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdAbbreviation");
		eiColumn.setType("C");
		block.addMeta(eiColumn);	
		
		eiColumn = new EiColumn("fdType");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdProjectPlace");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdDepartmentId");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdDepartment");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		block.addMeta(new EiColumn("fdNoName"));
		
		Map map = new HashMap();
		map.put("fdTypeIn", fdType);
		map.put("fdNotStatus", fdNotStatus);
		map.put("existPlan", "yes");
		List<Map> list = dao.query("ZMCSEngineering.queryPlanEngineering", map);
		for(int i = 0; i < list.size(); i++) {
			Map _map = list.get(i);
			_map.put("fdNoName", _map.get("fdNo")+"/"+_map.get("fdName"));
		}
		block.addRows(list);
		return block;
	}
}
